#include <iostream>
#include <cstdio>

#define N 10000005
#define m 1025

using namespace std;

struct S{
    int nation;
    int time;
}q[N];

int chk[m] = {0};

int main(){
    int n;
    cin >> n;
    int head = 1, tail = 1; // head(小) tail(大)
    int ans = 0;
    for(int i = 1; i <= n; i++){
        int shiptime, cnt;
        scanf("%d %d", &shiptime, &cnt);
        for(int j = 1; j <= cnt; j++){
            int nation;
            scanf("%d", &nation);
            q[tail].time = shiptime;
            q[tail].nation = nation;
            chk[nation]++;
            if(chk[nation] == 1)    ans++; // 只有新人可以算
            tail++;
        }
        while(head < tail && shiptime - q[head].time >= 86400){
            chk[q[head].nation]--;
            if(chk[q[head].nation] == 0)    ans--;
            head++;
        }
        printf("%d\n", ans);
    }
    return 0;
}